//
//  ZMYLKDB.h
//  奇阅
//
//  Created by 奇阅科技 on 14-10-21.
//  Copyright (c) 2014年 奇阅科技. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AdtHelper.h"
@interface ZMYLKDB : NSObject
///创建数据库
+(ZMYLKDB *)getLKDBHelper;
///清空数据库，并创建新表
-(void)removeAllTableData;
///创建表
//-(void)creatTable;


///更新活动
-(void)updateActivity:(Activity *)newActivity;
///获取某个位置的活动
-(NSArray *)getActivityWithPosition:(NSString *)position;
///清空某个位置的活动
-(void)clearActivityWithPosition:(NSString *)position;

///更新书架书本信息
-(void)updateBook:(Book *)book;
///添加书架
-(void)insertBookRack:(BookRack *)bookRack;
///移除书架
-(void)removeBookRack:(BookRack *)bookRack;
///更新书架
-(void)updateBookRack:(BookRack *)bookRack;
///获取书架
-(NSArray *)getBookRack;
///获取一本书是否在当前用户的书架
-(BOOL)getBookRack:(Book *)book;
///将uid='love'的图书添加到当前用户书架
-(NSArray *)addLoveBookRack;
///书架排序
-(void)changeBookRackFrom:(NSInteger)fromItem to:(NSInteger)toItem;

///更新已订阅数据库
-(void)updateMyVIPBook:(MyVIPBook *)bookRack;
///获取已订阅图书,从1开始
-(NSArray *)getMyVIPBookPage:(NSInteger)page;
///获取本地数据库我的订阅图书数量
-(int)getMyVIPBookCount;
///清空已购的图书表
-(void)clearMyVIPBook;

///更新收藏数据库
-(void)updateMyFavorBook:(MyFavorBook *)bookRack;
///判断是否收藏了一本书
-(BOOL)isHadFavorTheBook:(Book *)favorBook;
///获取收藏的图书
-(NSArray *)getMyFavorBook;
///移除一本收藏的图书
-(void)deleteMyFavorBook:(MyFavorBook *)favorBook;
///清空收藏的图书表
-(void)clearMyFavorBook;

///更新充值记录
-(void)updateRechargeRecord:(RechargeRecord *)rechargeRecord;
///获取充值记录
-(NSArray *)getRechargeRecordPage:(NSInteger)page;

///更新书籍详情

-(void)updateBookInfo:(BookInfo *)book;
///书籍详情
-(BookInfo *)getBookInfo:(NSString *)articleid;


///更新点赞状态
-(void)updateIsLike:(LikeComment *)newLike;
///获取目前点赞状态
-(BOOL)getIsLike:(LikeComment *)newLike;
///获取是否点过赞,有的话不请求点赞接口
-(BOOL)getIsLikeOnce:(LikeComment *)newLike;

///更新书评主题数据库
-(void)updateThemeComment:(ThemeComment *)myComment;
///根据作品ID获取书评主题
-(NSArray *)getThemeCommentWith:(NSString *)articleid;
///清空书评主题
-(void)clearThemeCommentDBWith:(NSString *)articleid;
//获取我的书评,从1开始
-(NSArray *)getMyCommentPage:(NSInteger)page;
///获取本地数据库某一本书我的书评,从1开始
-(NSArray *)getMyCommentBook:(Book *)book Page:(NSInteger)page;
///获取本地数据库我的订阅图书数量
-(int)getMyCommentCount;
///清空我的书评
-(void)clearMyCommentDB;

///更新回复
-(void)updateReplyComment:(ReplyComment *)myComment;
///根据主题评论获取书评的回复
-(NSArray *)getReplyCommentWith:(ThemeComment *)themeComment;
///清空书评主题
-(void)clearReplyCommentDBWith:(ThemeComment *)themeComment;


///更新书籍章节的名字和内容，如果没有则插入
-(void)updateBookChapterText:(BookChapterText *)bookChapterText;
///根据articleid和chapterId获取章节内容
-(BookChapterText *)getBookChapterTextWithArticleid:(NSString *)articleid chapterId:(NSString *)chapterId;
///根据articleid判断是否有下载
-(BOOL)getBookChapterTextWithArticleid:(NSString *)articleid;
///解析下载到的免费章节文件
-(BOOL)unarchiveFreeChapter:(NSString *)downloadFilePath Book:(Book *)book;

///更新阅读进度
-(void)updateReadSchedule:(ReadSchedule *)readSchedule;
///删除阅读进度
-(void)deleteReadSchedule:(NSString *)articleid;
///获取阅读进度
-(ReadSchedule *)getReadSchedule:(NSString *)articleid;

///添加书签
-(void)insertToBookmarkDB:(Bookmark *)bookmark;
///删除书签
-(void)deleteToBookmarkDB:(Bookmark *)bookmark;
///根据作品ID获取书签
-(NSArray *)getBookmarkArticleid:(NSString *)articleid;
///根据章节ID获取书签
-(NSArray *)getBookmarkChapterId:(NSString *)chapterId;


///添加高亮
-(void)insertToHighlightMarkDB:(HighlightMark *)highlightMark;
///删除高亮
-(void)deleteToHighlightMarkDB:(HighlightMark *)highlightMark;
///根据作品ID获取高亮
-(NSArray *)getHighlightMarkArticleid:(NSString *)articleid;
///根据章节ID获取高亮
-(NSArray *)getHighlightMarkChapterId:(NSString *)chapterId;


///添加笔记
-(void)insertToBookNoteDB:(BookNote *)highlightMark;
///删除笔记
-(void)deleteToBookNoteDB:(BookNote *)highlightMark;
///根据章节ID获取笔记
-(NSArray *)getBookNoteChapterId:(NSString *)chapterId;
@end
